---
title: useColorMode
description: "`useColorMode` is a custom hook that returns the current color mode."
storybook: hooks-usecolormode--basic
source: hooks/use-color-mode
---

```tsx preview functional client
const { colorMode } = useColorMode()

return <Text>The current colorMode is "{colorMode}"</Text>
```

## Usage

:::code-group

```tsx [package]
import { useColorMode } from "@yamada-ui/react"
```

```tsx [alias]
import { useColorMode } from "@/components/ui"
```

```tsx [monorepo]
import { useColorMode } from "@workspaces/ui"
```

:::

```tsx
const { changeColorMode, colorMode, internalColorMode, toggleColorMode } =
  useColorMode()
```

:::tip
Color Mode overview is [here](/docs/styling/color-mode).
:::

### Switching Color Mode

- `colorMode`: Provides the current color mode.
- `internalColorMode`: Provides the current color mode including `system`.

```tsx preview functional client
const { colorMode, internalColorMode, changeColorMode, toggleColorMode } =
  useColorMode()

return (
  <VStack>
    <Text>
      The current colorMode is "{colorMode}", internal colorMode is "
      {internalColorMode}"
    </Text>

    <Wrap gap="md">
      <Button onClick={() => changeColorMode("light")}>Light Mode</Button>
      <Button onClick={() => changeColorMode("dark")}>Dark Mode</Button>
      <Button onClick={() => changeColorMode("system")}>System</Button>
      <Button onClick={toggleColorMode}>
        Switch to {colorMode === "light" ? "Dark" : "Light"} Mode
      </Button>
    </Wrap>
  </VStack>
)
```
